-------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/xsigra/Dropbox/Upload/Table7.smcl
  log type:  smcl
 opened on:  11 Jul 2017, 12:16:31

. clear

. use "v-dem_coder2.dta"
(Written by R.              )

. 
. *Model 1: EqProtec 
. clear

. use "v-dem_coder2.dta"
(Written by R.              )

. gen phd=v2zzedlev>8 if v2zzedlev<.
(46,960 missing values generated)

. gen gov=employ==2 if employ<.
(45,408 missing values generated)

. keep country_id coder_id historical_date year v2clacjust_n v2clsocgrp_n v2cls
> nlpct_n phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzcurred

. preserve

.  reshape long v2,i(country_id coder_id historical_date phd gov v2zzgender v2z
> zfremrk v2zzreside v2zztimein v2zzcurred) j(ind) string
(note: j = clacjust_n clsnlpct_n clsocgrp_n zzcurred zzfremrk zzgender zzreside
>  zztimein)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                   253379   -> 2.0e+06
Number of variables                  14   ->      13
j variable (8 values)                     ->   ind
xij variables:
v2clacjust_n v2clsnlpct_n ... v2zztimein  ->   v2
-----------------------------------------------------------------------------

.  encode ind,gen(indnumb)

.  drop if v2==.
(800,953 observations deleted)

.  mixed v2  phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzcurred || 
> indnumb: || country_id:, robust  

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log pseudolikelihood = -22013.726  
Iteration 1:   log pseudolikelihood = -22013.726  

Computing standard errors:

Mixed-effects regression                        Number of obs     =    175,792

-------------------------------------------------------------
                |     No. of       Observations per Group
 Group Variable |     Groups    Minimum    Average    Maximum
----------------+--------------------------------------------
        indnumb |          3     43,438   58,597.3     73,039
     country_id |        510          1      344.7        999
-------------------------------------------------------------

                                                Wald chi2(2)      =          .
Log pseudolikelihood = -22013.726               Prob > chi2       =          .

                                (Std. Err. adjusted for 3 clusters in indnumb)
------------------------------------------------------------------------------
             |               Robust
          v2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         phd |  -.0114275   .0176622    -0.65   0.518    -.0460448    .0231898
         gov |  -.0074041    .014147    -0.52   0.601    -.0351318    .0203236
  v2zzgender |   .0022518   .0078154     0.29   0.773    -.0130661    .0175698
  v2zzfremrk |   .0087988   .0047486     1.85   0.064    -.0005082    .0181058
  v2zzreside |  -.0001918   .0000359    -5.34   0.000    -.0002622   -.0001213
  v2zztimein |   .0012825   .0004706     2.73   0.006     .0003602    .0022049
  v2zzcurred |    .002392   .0029415     0.81   0.416    -.0033732    .0081573
       _cons |   .4488669   .0269844    16.63   0.000     .3959784    .5017553
------------------------------------------------------------------------------

------------------------------------------------------------------------------
                             |               Robust           
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
indnumb: Identity            |
                  var(_cons) |   .0015099   .0009017      .0004684    .0048669
-----------------------------+------------------------------------------------
country_id: Identity         |
                  var(_cons) |   .0437486    .002282      .0394969    .0484579
-----------------------------+------------------------------------------------
               var(Residual) |   .0741134   .0106198      .0559663    .0981447
------------------------------------------------------------------------------

. restore

. 
. *Model 2: EqDist
. clear

. use "v-dem_coder2.dta"
(Written by R.              )

. gen phd=v2zzedlev>8 if v2zzedlev<.
(46,960 missing values generated)

. gen gov=employ==2 if employ<.
(45,408 missing values generated)

. keep country_id coder_id historical_date year v2dlencmps_n v2dlunivl_n v2peed
> ueq_n v2pehealth_n  phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzc
> urred

. preserve

.  reshape long v2,i(country_id coder_id historical_date phd gov v2zzgender v2z
> zfremrk v2zzreside v2zztimein v2zzcurred) j(ind) string
(note: j = dlencmps_n dlunivl_n peedueq_n pehealth_n zzcurred zzfremrk zzgender
>  zzreside zztimein)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                   253379   -> 2.3e+06
Number of variables                  15   ->      13
j variable (9 values)                     ->   ind
xij variables:
v2dlencmps_n v2dlunivl_n ... v2zztimein   ->   v2
-----------------------------------------------------------------------------

.  encode ind,gen(indnumb)

.  drop if v2==.
(931,733 observations deleted)

.  mixed v2  phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzcurred || 
> indnumb: || country_id:, robust 

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log pseudolikelihood = -58665.862  
Iteration 1:   log pseudolikelihood = -58665.862  

Computing standard errors:

Mixed-effects regression                        Number of obs     =    287,098

-------------------------------------------------------------
                |     No. of       Observations per Group
 Group Variable |     Groups    Minimum    Average    Maximum
----------------+--------------------------------------------
        indnumb |          4     71,088   71,774.5     72,598
     country_id |        696         10      412.5        906
-------------------------------------------------------------

                                                Wald chi2(3)      =          .
Log pseudolikelihood = -58665.862               Prob > chi2       =          .

                                (Std. Err. adjusted for 4 clusters in indnumb)
------------------------------------------------------------------------------
             |               Robust
          v2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         phd |   .0056475   .0062305     0.91   0.365     -.006564     .017859
         gov |  -.0596914   .0250402    -2.38   0.017    -.1087694   -.0106135
  v2zzgender |  -.0255333   .0101764    -2.51   0.012    -.0454787   -.0055879
  v2zzfremrk |   .0096859   .0034375     2.82   0.005     .0029485    .0164233
  v2zzreside |  -.0002824    .000094    -3.00   0.003    -.0004666   -.0000981
  v2zztimein |   .0003119   .0001978     1.58   0.115    -.0000758    .0006997
  v2zzcurred |   .0327923   .0128583     2.55   0.011     .0075904    .0579941
       _cons |   .4496923   .0406355    11.07   0.000     .3700483    .5293364
------------------------------------------------------------------------------

------------------------------------------------------------------------------
                             |               Robust           
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
indnumb: Identity            |
                  var(_cons) |   .0004887   .0002591      .0001729    .0013813
-----------------------------+------------------------------------------------
country_id: Identity         |
                  var(_cons) |   .0468309   .0075781      .0341029    .0643092
-----------------------------+------------------------------------------------
               var(Residual) |   .0869894   .0084529      .0719041    .1052397
------------------------------------------------------------------------------

. restore

. 
. *Model 3: EqAcc
. clear

. use "v-dem_coder2.dta"
(Written by R.              )

. gen phd=v2zzedlev>8 if v2zzedlev<.
(46,960 missing values generated)

. gen gov=employ==2 if employ<.
(45,408 missing values generated)

. keep country_id coder_id historical_date year v2pepwrses_n v2pepwrsoc_n v2pep
> wrgen_n phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzcurred

. preserve

.  reshape long v2,i(country_id coder_id historical_date phd gov v2zzgender v2z
> zfremrk v2zzreside v2zztimein v2zzcurred) j(ind) string
(note: j = pepwrgen_n pepwrses_n pepwrsoc_n zzcurred zzfremrk zzgender zzreside
>  zztimein)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                   253379   -> 2.0e+06
Number of variables                  14   ->      13
j variable (8 values)                     ->   ind
xij variables:
v2pepwrgen_n v2pepwrses_n ... v2zztimein  ->   v2
-----------------------------------------------------------------------------

.  encode ind,gen(indnumb)

.  drop if v2==.
(760,165 observations deleted)

.  mixed v2  phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzcurred || 
> indnumb: || country_id:, robust 

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log pseudolikelihood = -23139.434  
Iteration 1:   log pseudolikelihood = -23139.434  

Computing standard errors:

Mixed-effects regression                        Number of obs     =    217,443

-------------------------------------------------------------
                |     No. of       Observations per Group
 Group Variable |     Groups    Minimum    Average    Maximum
----------------+--------------------------------------------
        indnumb |          3     72,103   72,481.0     72,934
     country_id |        522         14      416.6        827
-------------------------------------------------------------

                                                Wald chi2(2)      =          .
Log pseudolikelihood = -23139.434               Prob > chi2       =          .

                                (Std. Err. adjusted for 3 clusters in indnumb)
------------------------------------------------------------------------------
             |               Robust
          v2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         phd |  -.0034383   .0064168    -0.54   0.592     -.016015    .0091385
         gov |  -.0667822   .0104595    -6.38   0.000    -.0872825   -.0462819
  v2zzgender |   -.002577   .0058144    -0.44   0.658    -.0139731     .008819
  v2zzfremrk |   .0149451   .0029198     5.12   0.000     .0092224    .0206678
  v2zzreside |  -.0000277   .0001057    -0.26   0.793    -.0002348    .0001795
  v2zztimein |   .0007444   .0003644     2.04   0.041     .0000303    .0014585
  v2zzcurred |   .0127432   .0042298     3.01   0.003     .0044529    .0210335
       _cons |   .3263801   .0291396    11.20   0.000     .2692676    .3834926
------------------------------------------------------------------------------

------------------------------------------------------------------------------
                             |               Robust           
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
indnumb: Identity            |
                  var(_cons) |   .0030934   .0016722      .0010722    .0089244
-----------------------------+------------------------------------------------
country_id: Identity         |
                  var(_cons) |   .0317691   .0072399      .0203247    .0496576
-----------------------------+------------------------------------------------
               var(Residual) |   .0715562   .0052927      .0618996    .0827193
------------------------------------------------------------------------------

. restore

. 
. *Model 4: Egal
.  
. clear

. use "v-dem_coder2.dta"
(Written by R.              )

. gen phd=v2zzedlev>8 if v2zzedlev<.
(46,960 missing values generated)

. gen gov=employ==2 if employ<.
(45,408 missing values generated)

. keep country_id coder_id historical_date year phd gov v2zzgender v2zzfremrk v
> 2zzreside v2zztimein v2zzcurred v2clacjust_n v2clsocgrp_n v2clsnlpct_n v2dlen
> cmps_n v2dlunivl_n v2peedueq_n v2pehealth_n v2pepwrses_n v2pepwrsoc_n v2pepwr
> gen_n 

. preserve

.  reshape long v2,i(country_id coder_id historical_date phd gov v2zzgender v2z
> zfremrk v2zzreside v2zztimein v2zzcurred) j(ind) string
(note: j = clacjust_n clsnlpct_n clsocgrp_n dlencmps_n dlunivl_n peedueq_n pehe
> alth_n pepwrgen_n pepwrses_n pepwrsoc_n zzcurred zzfremrk zzgender zzreside z
> ztimein)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                   253379   -> 3.8e+06
Number of variables                  21   ->      13
j variable (15 values)                    ->   ind
xij variables:
v2clacjust_n v2clsnlpct_n ... v2zztimein  ->   v2
-----------------------------------------------------------------------------

.  encode ind,gen(indnumb)

.  drop if v2==.
(1,994,081 observations deleted)

.  mixed v2  phd gov v2zzgender v2zzfremrk v2zzreside v2zztimein v2zzcurred || 
> indnumb: || country_id:, robust  /* THIS TOOK THREE HOURS TO RUN! */

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log pseudolikelihood = -105789.55  
Iteration 1:   log pseudolikelihood = -105789.55  

Computing standard errors:

Mixed-effects regression                        Number of obs     =    680,333

-------------------------------------------------------------
                |     No. of       Observations per Group
 Group Variable |     Groups    Minimum    Average    Maximum
----------------+--------------------------------------------
        indnumb |         10     43,438   68,033.3     73,039
     country_id |      1,728          1      393.7        999
-------------------------------------------------------------

                                                Wald chi2(7)      =     286.62
Log pseudolikelihood = -105789.55               Prob > chi2       =     0.0000

                               (Std. Err. adjusted for 10 clusters in indnumb)
------------------------------------------------------------------------------
             |               Robust
          v2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         phd |  -.0015599   .0057082    -0.27   0.785    -.0127476    .0096279
         gov |  -.0502098   .0128505    -3.91   0.000    -.0753963   -.0250234
  v2zzgender |  -.0112363   .0059152    -1.90   0.057    -.0228298    .0003572
  v2zzfremrk |   .0109259   .0020263     5.39   0.000     .0069544    .0148975
  v2zzreside |  -.0001773   .0000597    -2.97   0.003    -.0002943   -.0000602
  v2zztimein |     .00069   .0002164     3.19   0.001     .0002658    .0011142
  v2zzcurred |   .0184785   .0067177     2.75   0.006     .0053121    .0316449
       _cons |   .4134508   .0265275    15.59   0.000     .3614578    .4654437
------------------------------------------------------------------------------

------------------------------------------------------------------------------
                             |               Robust           
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
indnumb: Identity            |
                  var(_cons) |   .0031287   .0018931      .0009557    .0102427
-----------------------------+------------------------------------------------
country_id: Identity         |
                  var(_cons) |   .0412725   .0040792      .0340041    .0500945
-----------------------------+------------------------------------------------
               var(Residual) |   .0788658   .0048632      .0698875    .0889974
------------------------------------------------------------------------------

. restore

. 
. log close
      name:  <unnamed>
       log:  /Users/xsigra/Dropbox/Upload/Table7.smcl
  log type:  smcl
 closed on:  11 Jul 2017, 12:35:26
-------------------------------------------------------------------------------
